package com.cn.wanxi.controller;

import com.alibaba.fastjson.JSONObject;

import com.cn.wanxi.entity.UserEntity;
import com.cn.wanxi.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

//代表的页面控制层
@RestController
public class LoginController {
    @Autowired
    private IUserService iUserService;

    @RequestMapping("/login")
    @ResponseBody
    public void login(UserEntity userEntity, HttpServletResponse resp) throws IOException {
        String result=iUserService.login(userEntity);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("result", result);
        resp.getWriter().println(jsonObject);
    }
}
